import { BaseEntity } from '@/types/base';

// 分类类型
export const enum CategoryType {
  ARTICLE = 'A',  // 文章分类
  PRODUCT = 'P',  // 产品分类
  CASE = 'C',      // 案例分类
  PAGE = 'P',     // 单页分类
}

// 分类查询对象
export interface CategoryQuery {
  title?: string;
  categoryType?: CategoryType;
}

// 分类对象
export interface CategoryVO extends BaseEntity {
  id: string;
  parentId: string;
  ancestors: string;
  title: string;
  slug: string;
  path: string;
  categoryType: CategoryType;
  template: string;
  sort: number;
  isShow: string;
  seoTitle: string;
  seoKeywords: string;
  seoDescription: string;
  customFields: string;
  children?: CategoryVO[];
  menuIds?: string[]; // 导航菜单ID数组
}

// 分类表单对象
export interface CategoryForm {
  id?: string;
  parentId: string;
  title: string;
  path: string;
  categoryType: CategoryType;
  template?: string;
  sort: number;
  isShow: string;
  status: string;
  seoTitle?: string;
  seoKeywords?: string;
  seoDescription?: string;
  customFields?: string;
  remark?: string;
  linkType: number;     // 0:内部链接 1:外部链接
  menuId?: string;      // 关联菜单ID
  linkUrl?: string;     // 外链地址
  linkTarget: string;   // 打开方式 _self/_blank
  isNav: string;     // 是否导航(0否 1是)
  navType: string;   // 导航类型(1顶部 2底部 3都显示)
  menuIds: string[];  // 导航菜单ID数组
}

// 分类接口
export interface Category {
  id: number;
  parentId: number;
  ancestors: string;
  categoryName: string;
  categoryType: CategoryType;
  icon?: string;
  description?: string;
  keywords?: string;
  sort: number;
  isNav: string;
  template?: string;
  linkType: LinkType;
  linkUrl?: string;
}

// 树形分类节点
export interface CategoryNode extends Category {
  children?: CategoryNode[];
  parentName?: string;
  hasChildren?: boolean;
}

export const enum LinkType {
  INTERNAL = '0',  // 内部链接
  EXTERNAL = '1'   // 外部链接
}

// 导航类型枚举
export const enum NavType {
  TOP = '1',     // 顶部导航
  BOTTOM = '2',  // 底部导航
  BOTH = '3'     // 都显示
}